<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .container {
        width: 500px;
        margin: 20px auto;
        display: flex;
    }

    .left {
        width: 250px;
        height: 200px;
        background-color: tomato;
    }

    .right {
        width: 250px;
        height: 200px;
        background-color: rgb(114, 114, 114);
        transition: all .5s;
    }
</style>

<body>
    <div class="container">
        <div class="left"></div>
        <div class="right"></div>
    </div>
</body>
<script>
    let left = document.querySelector('.left')
    let right = document.querySelector('.right')
    right.addEventListener('click', function () {
        right.style.transform = 'rotateY(90deg)'
        right.style.transform = 'translate(-250px)'
    })
</script>

</html>